﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdminOpretProjekt.aspx.cs"
    Inherits="TidsRegWEB.AdminOpretProjekt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    <script>
        $(function () {
            $("#TxtOpretStartDato").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: "c-20:c+20",
                dateFormat: "dd/mm-yy"
            });
        });
        $(function () {
            $("#TxtOpretSlutDato").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: "c-20:c+20",
                dateFormat: "dd/mm-yy"
            });
        });
    </script>
    <title></title>
    <style type="text/css">
        #Select1
        {
            width: 113px;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function showdiv() {
            document.getElementById("divChkList").style.display = "block";
        }
        function showdivonClick() {
            var objDLL = document.getElementById("divChkList");
            if (objDLL.style.display == "block")
                objDLL.style.display = "none";
            else
                objDLL.style.display = "block";
        }
        function getSelectedItem(lstValue, lstNo, lstID, ctrlType) {
            var noItemChecked = 0;
            var ddlReport = document.getElementById("ddlChkList");
            var selectedItems = "";
            var arr = document.getElementById("chkLstItem").getElementsByTagName('input');
            var arrlbl = document.getElementById("chkLstItem").getElementsByTagName('label');
            var objLstId = document.getElementById('hidList');
            for (i = 0; i < arr.length; i++) {
                checkbox = arr[i];
                if (i == lstNo) {
                    if (ctrlType == 'anchor') {
                        if (!checkbox.checked) {
                            checkbox.checked = true;
                        }
                        else {
                            checkbox.checked = false;
                        }
                    }
                }
                if (checkbox.checked) {
                    if (selectedItems == "") {
                        selectedItems = arrlbl[i].innerText;
                    }
                    else {
                        selectedItems = selectedItems + "," + arrlbl[i].innerText;
                    }
                    noItemChecked = noItemChecked + 1;
                }
            }
            ddlReport.title = selectedItems;
            var Text = ddlReport.options[ddlReport.selectedIndex].text;
            if (noItemChecked == 1)
                ddlReport.options[ddlReport.selectedIndex].text = lstValue;
            else
                ddlReport.options[ddlReport.selectedIndex].text = noItemChecked + " Items";
            document.getElementById('hidList').value = ddlReport.options[ddlReport.selectedIndex].text;
        }

        document.onclick = check;
        function check(e) {
            var target = (e && e.target) || (event && event.srcElement);
            var obj = document.getElementById('divChkList');
            var obj1 = document.getElementById('ddlChkList');
            if (target.id != "alst" && !target.id.match("chkLstItem")) {
                if (!(target == obj || target == obj1)) {
                    obj.style.display = 'none'
                }
                else if (target == obj || target == obj1) {
                    if (obj.style.display == 'block') {
                        obj.style.display = 'block';
                    }
                    else {
                        obj.style.display = 'none';
                        document.getElementById('ddlChkList').blur();
                    }
                }
            }
        }
    </script>
    <!--

        function Select1_onclick() {
        }

// -->
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <h1>
            Administrator</h1>
        <h3>
            Opret projekt</h3>
        <p>
            Indtast projekt navn
            <asp:TextBox ID="TxtOpretProjektNavn" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="TxtOpretProjektNavn" ErrorMessage="Husk projektnavn"></asp:RequiredFieldValidator>
        </p>
        <p>
            Indtast beskrivelse
            <asp:TextBox ID="TxtBeskrivelse" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="TxtBeskrivelse" ErrorMessage="Husk beskrivelse af projektet"></asp:RequiredFieldValidator>
        </p>
        <p >
            Vælg medarbejdere der skal tilknyttes projektet
            <table align="center">
                <tr>
                    <td valign="top" style="width: 165px">
                        <asp:PlaceHolder ID="phDDLCHK" runat="server"></asp:PlaceHolder>
                    </td>
                    <td valign="top">
                        <asp:Button ID="btn" runat="server" Text="Get Checked" OnClick="btn_Click" />
                    </td>
                    <td valign="top">
                        <asp:Label ID="lblSelectedItem" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
            <asp:HiddenField ID="hidList" runat="server" />
            <%--<asp:DropDownList ID="DdlOpretProjektMedarbejdere" runat="server">
            </asp:DropDownList>--%>
        </p>
        <p style="text-align: center">
            indtast projektets start dato
            <asp:TextBox ID="TxtOpretStartDato" runat="server"></asp:TextBox>
            &nbsp;og projektets slutdato
            <asp:TextBox ID="TxtOpretSlutDato" runat="server"></asp:TextBox>
        </p>
        <p style="text-align: center">
            <asp:Label ID="LbBesked" runat="server"></asp:Label>
        </p>
        <p style="text-align: center">
            <asp:Button ID="BtnOpretProjekt" runat="server" Text="Opret Projekt" OnClick="BtnOpretProjekt_Click" />
        </p>
    </form>
</body>
</html>
